package com.yaorange.certificate.controller.wx;

import com.yaorange.certificate.domain.NjtArea;
import com.yaorange.certificate.service.INjtAreaService;
import com.yaorange.certificate.service.NjtCommonService;
import com.yaorange.common.core.domain.AjaxResult;
import com.yaorange.common.core.domain.entity.SysDictData;
import com.yaorange.system.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author coach tam
 * @email 327395128@qq.com
 * @values 坚持灵活 灵活坚持
 * @since 2025/4/30
 */
@RestController
@RequestMapping("/api/common")
public class NjtCommonController {

    @Autowired
    private ISysDictDataService sysDictDataService;

    @Autowired
    private NjtCommonService njtCommonService;

    @GetMapping("/queryDictType")
    public AjaxResult queryDictType(@RequestParam(value = "dictType") String dictType) {
        SysDictData sysDictData = new SysDictData();
        sysDictData.setDictType(dictType);
        return AjaxResult.success(sysDictDataService.selectDictDataList(sysDictData));
    }

    @PostMapping("/upload")
    public AjaxResult upload(@RequestPart("file") MultipartFile file) {
        String path = njtCommonService.upload(file);
        return AjaxResult.success(path);
    }
}
